//
//  CModelAction.h
//  GoldOperationClient
//
//  Created by yaxue wang on 16/8/1.
//  Copyright © 2016年 展鸿科技. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@interface CModelAction : NSObject
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;

@property (retain, nonatomic) NSString *tableName;

- (id) initWithTableName:(NSString *) tablename;
- (NSMutableArray*) fetchDataWithWhere:(NSString *)where WithOrder:(NSString *) order WithLimit:(NSInteger)limit FromOffset:(NSInteger) offset;
- (NSMutableArray*) fetchDataWithWhere:(NSString *)where WithOrder:(NSString *) order WithLimit:(NSInteger)limit;
- (NSMutableArray *) fetchOneWithWhere:(NSString *)where WithOrder:(NSString *)order;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
- (void) InsertData:(id *) table;
- (BOOL) DeleteData:(id *) table;

@end
